package com.framework.common.enums.annex;

/**
 * @author 龘鵺
 * @version 1.0
 * @className com.framework.common.enums.annex
 * @description 分组枚举类
 * @datetime 2024-12-13 16:42:51
 */
public enum GroupStatusEnum {
    //${bucket}
//    code1("private", "私有(默认)",
//            "{\"Version\":\"2012-10-17\",\"Statement\":[]}"),
//    code2("public", "公开",
//            "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucket\",\"s3:ListBucketMultipartUploads\"],\"Resource\":[\"arn:aws:s3:::${bucket}\"]},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetObject\",\"s3:ListMultipartUploadParts\",\"s3:PutObject\",\"s3:AbortMultipartUpload\",\"s3:DeleteObject\"],\"Resource\":[\"arn:aws:s3:::${bucket}/*\"]}]}"),
    code3("readonly", "只读(建议)", "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetBucketLocation\"],\"Resource\":[\"arn:aws:s3:::${bucket}\"]},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:ListBucket\"],\"Resource\":[\"arn:aws:s3:::${bucket}\"],\"Condition\":{\"StringEquals\":{\"s3:prefix\":[\"*\"]}}},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetObject\"],\"Resource\":[\"arn:aws:s3:::${bucket}/**\"]}]}"),
    code4("writeonly", "只写", "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucketMultipartUploads\"],\"Resource\":[\"arn:aws:s3:::${bucket}\"]},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:PutObject\",\"s3:AbortMultipartUpload\",\"s3:DeleteObject\",\"s3:ListMultipartUploadParts\"],\"Resource\":[\"arn:aws:s3:::${bucket}/**\"]}]}"),
    code5("readwrite", "读写",
            "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucketMultipartUploads\"],\"Resource\":[\"arn:aws:s3:::${bucket}\"]},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:ListBucket\"],\"Resource\":[\"arn:aws:s3:::${bucket}\"],\"Condition\":{\"StringEquals\":{\"s3:prefix\":[\"*\"]}}},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:DeleteObject\",\"s3:GetObject\",\"s3:ListMultipartUploadParts\",\"s3:PutObject\",\"s3:AbortMultipartUpload\"],\"Resource\":[\"arn:aws:s3:::${bucket}/**\"]}]}");

    private String status;
    private String name;
    private String content;

    GroupStatusEnum(String status, String name, String content) {
        this.status = status;
        this.name = name;
        this.content = content;
    }

    public static GroupStatusEnum getInfo(String status) {
        GroupStatusEnum[] values = GroupStatusEnum.values();
        for (GroupStatusEnum item : values) {
            if (item.getStatus().equalsIgnoreCase(status)) {
                return item;
            }
        }
        return null;
    }

    public String getStatus() {
        return status;
    }

    public String getName() {
        return name;
    }

    public String getContent() {
        return content;
    }
}
